package com.hzeport.bgs22emduty.inbound.api;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.dto.ParamHolidaysDTO;
import com.hzeport.bgs22emduty.entity.ParamHolidays;
import com.hzeport.bgs22emduty.service.ParamHolidaysService;
import com.hzeport.bgs22emduty.vo.ParamHolidays.ParamHolidaysSaveVO;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.awt.*;
import java.util.List;

/**
 * 假期年度：
    说明假期使用的年度

假期日期：
    年度假期的具体日期，yyyy-MM-dd
 *
 * @author code generator
 * @date 2022-12-02 11:21:59
 */
@RestController
@AllArgsConstructor
@RequestMapping("/paramholidays")
@Api(value = "paramholidays", tags = "节假日管理")
@Slf4j
public class ParamHolidaysController {

    @Resource
    private final ParamHolidaysService paramHolidaysService;

    @ApiOperation(value = "根据年份查询")
    @RequestMapping(value = "list",method = RequestMethod.POST)
    public BaseResult<PageInfo<ParamHolidays>>  list(@RequestBody  ParamHolidaysDTO paramHolidaysDTO) throws Exception {
        return paramHolidaysService.list(paramHolidaysDTO);
    }


    @ApiOperation(value = "删除")
    @RequestMapping(value = "delete",method = RequestMethod.POST)
    @OperLog( systemName = "JJRGL", description = "JJRSC")
    public BaseResult removeById(@RequestParam("id") String id) {
        return paramHolidaysService.delete(id);
    }

//    @ApiOperation(value = "初始化日期")
//    @PostMapping("/init")
//    public BaseResult<List<ParamHolidays>> init(@RequestBody  ParamHolidaysDTO paramHolidaysDTO) throws Exception {
//        return paramHolidaysService.init(paramHolidaysDTO);
//    }

//    @ApiOperation(value = "获取详情")
//    @RequestMapping(value = "detail",method = RequestMethod.GET)
//    public BaseResult<ParamHolidaysListVO> detail(@RequestParam("id") String id) throws Exception {
//        return paramHolidaysService.detail(id);
//    }

    @ApiOperation(value = "保存")
    @PostMapping("/save")
    @OperLog( systemName = "JJRGL", description = "JJRBC")
    public BaseResult save(@RequestBody ParamHolidaysSaveVO paramHolidaysSaveVO) {
        return paramHolidaysService.saveData(paramHolidaysSaveVO);
    }

}
